package arcane.object.gui;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Insets;

import arcane.object.game.sprite.MenuSprite;

public class BevelBorder implements Border {
	public static final int BEVEL_UP = 0, BEVEL_DOWN = 1;
	int bevel;

	public BevelBorder(int bevel) {
		this.bevel = bevel;
	}

	public void setBevel(int bevel) {
		this.bevel = bevel;
	}

	public int getBevel() {
		return bevel;
	}

	public void paintBorder(MenuSprite sprite, Graphics2D g) {
		Insets inset = sprite.getInsets();
		int width = sprite.getWidth()+inset.right+inset.left;
		int height = sprite.getHeight()+inset.bottom+inset.top;
		int x = (int) sprite.getScreenX()-inset.left;
		int y = (int) sprite.getScreenY()-inset.top;
		switch (bevel) {
		case (BEVEL_UP):
			g.setColor(Color.WHITE);
			g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
			g.drawLine(x + width - 1, y, x + width - 1, y + height - 1);
			g.setColor(Color.BLACK);
			g.drawLine(x, y, x + width - 1, y-1);
			g.drawLine(x, y, x, y + height - 2);
			break;
		case (BEVEL_DOWN):
			g.setColor(Color.BLACK);
			g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
			g.drawLine(x + width - 1, y, x + width - 1, y + height - 1);
			g.setColor(Color.WHITE);
			g.drawLine(x, y, x + width - 1, y);
			g.drawLine(x, y, x, y + height - 1);
			break;
		}
	}

}
